home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / cameraImagePlaneUpdate.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.8 KB  |  90 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //
  20. //  Creation Date:    June 30, 1997
  21. //  Author:        cdt
  22. //
  23. //  Procedure Name:
  24. //      cameraImagePlaneUpdate
  25. //
  26. //  Description:
  27. //      Initialize an image plane for a camera.
  28. //
  29. //  Input Value:
  30. //      camera - name of the camera to attach image plane to
  31. //      imagePlane - name of the image plane
  32. //
  33. //  Output Value:
  34. //      None
  35. //
  36.  
  37. //
  38. //  Procedure Name:
  39. //      updatePort
  40. //
  41.  
  42. proc updatePort( string $cameraShape )
  43. {
  44.     string $panels[] = `getPanel -type "modelPanel"`;
  45.  
  46.     for ($modelPanel in $panels) {
  47.         string $modelCamera = `modelPanel -q -camera $modelPanel`;
  48.  
  49.         if ($modelCamera != "") {
  50.             string $shapes[] = `listRelatives -shapes $modelCamera`;
  51.  
  52.             for ($shape in $shapes) {
  53.                 if ($shape == $cameraShape) {
  54.                     string $editor = `modelPanel -q -modelEditor $modelPanel`;
  55.                     modelEditor -e -updateColorMode $editor;
  56.                     break;
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63. global proc cameraImagePlaneUpdate( string $camera, string $imagePlane )
  64. {
  65.     connectAttr -nextAvailable
  66.         ($imagePlane+".message") ($camera+".imagePlane");
  67.  
  68.     setAttr
  69.         ($imagePlane+".lockedToCamera") (!`getAttr ($camera+".orthographic")`);
  70.  
  71.     setAttr
  72.         ($imagePlane+".sizeX") `getAttr ($camera+".horizontalFilmAperture")`;
  73.     setAttr
  74.         ($imagePlane+".sizeY") `getAttr ($camera+".verticalFilmAperture")`;
  75.  
  76.     setAttr
  77.         ($imagePlane+".width") `getAttr ($camera+".orthographicWidth")`;
  78.     setAttr
  79.         ($imagePlane+".height") `getAttr ($camera+".orthographicWidth")`;
  80.  
  81.     float $coi[] = `camera -q -worldCenterOfInterest $camera`;
  82.     setAttr ($imagePlane+".center") -type "double3" $coi[0] $coi[1] $coi[2];
  83.  
  84.     // Ensure the image plane outline is drawn and selectable.
  85.     string $parents[] = `listRelatives -parent $camera`;
  86.     for ($item in $parents) showHidden -below $item;
  87.  
  88.     updatePort( $camera );
  89. }
  90.